﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace Peninsula.Web
{
    public class RouteConfig
    {
        //public static void RegisterRoutes(RouteCollection routes)
        //{
        //    routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        //    routes.MapRoute(
        //        name: "Default",
        //        url: "{controller}/{action}/{id}",
        //        defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
        //    );
        //}




        public const string AdminDefault = "AdminDefault";

       // public const string AdminDefault2 = "AdminDefault2";
        /// <summary>
        /// 错误页面路由
        /// </summary>
        public const string Error = "Error";

        /// <summary>
        /// 信息页面路由
        /// </summary>
        public const string Message = "Message";

        /// <summary>
        /// api注册
        /// </summary>
        public const string DefaultApi = "DefaultApi";

        /// <summary>
        /// 默认路由
        /// </summary>
        public const string Default = "Default";

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            //错误页面路由
            routes.MapRoute(
                name: Error,
                url: "errors/{code}.html",
                defaults: new { controller = "Errors", action = "Error", id = UrlParameter.Optional },
                namespaces: new string[] { "Peninsula.Web.Controllers" }
            );

            //错误页面路由
            routes.MapRoute(
                name: Message,
                url: "messages/{code}.html",
                defaults: new { controller = "Messages", action = "Message", id = UrlParameter.Optional },
                namespaces: new string[] { "Peninsula.Web.Controllers" }
            );

            //routes.MapRoute(
            //    name: "Default",
            //    url: "{controller}/{action}/{id}",
            //    defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
            //    namespaces: new string[] { "Express.Web.Controllers" }
            //);
            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
                namespaces: new string[] { "Peninsula.Web.Controllers" }
            );
        }
    }
}
